package com.ctshk.rpc.payment.utils.mastercard;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

/**
 * @author hef
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
@Builder
public class ApiRequest {

    private String apiOperation;
    private String apiMethod = "PUT";
    private String sourceType;
    private String sourceToken;
    private String merchant;

    // Order details
    private String orderId;
    private String orderAmount;
    private String orderCurrency;
    private String orderDescription;
    private String orderNotificationUrl;
    private String transactionId;
    private String targetTransactionId;
    private String transactionAmount;
    private String transactionCurrency;

    // Card data
    private String cardNumber;
    private String expiryMonth;
    private String expiryYear;
    private String securityCode;

    // Browser payments properties
    private String returnUrl;
    private String browserPaymentOperation;
    private String browserPaymentConfirmation;

    // 3DS properties
    private String sessionId;
    private String secureId;
    private String secureIdResponseUrl;
    private String paymentAuthResponse;

    // Wallet properties

    private String masterpassOriginUrl;
    private String masterpassOauthToken;
    private String masterpassOauthVerifier;
    private String masterpassCheckoutUrl;

    private String walletProvider;

    /**
     * 转换成请求格式
     * @return
     */
    public String buildReqJson() {
        return ApiRequestService.buildJSONPayload(this);
    }
}
